﻿<!DOCTYPE html>
<html>

<head id="Head1" runat="server">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>周计划看板</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <link rel="Shortcut Icon" href="../images/tempoBI.ico" type="image/x-icon" />
  <link rel="stylesheet" href="../StaticFiles/layui/dist/css/layui.css" />
  <link rel="stylesheet" href="../StaticFiles/layui/admin.css" />
  <link rel="stylesheet" href="../styles/pace.css" />
  <script type="text/javascript" src="../Scripts/pace.min.js"></script>
  <script type="text/javascript" src="../Scripts/json2.js"></script>
  <script type="text/javascript" src="../Scripts/jquery-1.11.2.min.js"></script>
  <style type="text/css">
    html {
      background-image: url(../images/bg.jpg);
      background-repeat: repeat-y;
    }

    #header {
      height: 60px;
      background-image: url(../images/抬头.png);
      background-size: 100% 60px;
      background-repeat: no-repeat;
      color: #fff;
      font-weight: bold;
      text-align: center;
      font-size: 28px;
      line-height: 60px;
    }

    .layui-card {
      background-color: transparent;
    }

    .layui-layer-title {
      text-align: center;
      font-weight: bold;
      font-size: 18px !important;
      color: #009688 !important;
    }

    .layui-table-view th {
      font-weight: bold;
      font-size: 16px;
      text-align: center;
      color: #009688;
    }

    .layui-card-header {
      color: #fff;
      border: none;
      text-align: center;
      font-size: 20px;
      font-weight: bold;
      letter-spacing: 0.1em;
    }

    #pichanPlan {
      background-color: transparent !important;
    }

    .layui-table tr:hover,
    .layui-table[lay-even] tr:nth-child(even) {
      background-color: transparent !important;
    }

    #pichanPlan td,
    #pichanPlan th {
      text-align: center;
      width: 12.5%;
      color: #fff;
    }

    #pichanPlan th {
      font-weight: bold;
    }

    #pichanPlan td div {
      margin: 5px;
      padding: 5px;
      cursor: pointer;
    }

    table {
      background-color: transparent !important;
    }

    table thead th {
      background-color: transparent !important;
      font-weight: bold;
    }

    .status-lable {
      display: inline-block;
      height: 28px;
      line-height: 28px;
      width: 120px;
      text-align: center;
      border-radius: 3px;
      margin-right: 5px;
    }

    .red {
      background-color: red;
      color: #fff;
      border-radius: 3px;
    }

    .red-lable {
      border: 1px solid red;
      background: red;
      color: #fff;
    }

    .green {
      background-color: #5FB878;
      color: #fff;
      border-radius: 3px;
    }

    .green-lable {
      border: 1px solid #5FB878;
      background: #5FB878;
      color: #fff;
    }

    .yellow {
      background-color: yellow;
      color: #000;
      border-radius: 3px;
    }

    .yellow-lable {
      border-radius: 3px;
      color: #000;
      background-color: Yellow;
    }

    .finished {
      background-color: #00FF00;
      color: #000;
      border-radius: 3px;
    }

    .finished-lable {
      border: 1px solid #00ff00;
      background: #00FF00;
      color: #000;
    }

    .transparent-lable {
      border: 1px solid #fff;
      width: 150px;
      color: #fff;
    }

    .transparent {
      border: 1px solid #fff;
      border-radius: 3px;
    }

    .lable-btn {
      vertical-align: top;
    }
  </style>
</head>

<body>
  <!--[if lt IE 9]>
        <script src="../Scripts/pollyfills/es5-shim.min.js"></script>
        <script src="../Scripts/pollyfills/es5-sham.min.js"></script>
        <script src="../Scripts/pollyfills/html5.js"></script>
        <script src="../Scripts/pollyfills/response.js"></script>
    <![endif]-->

  <div class="layui-row" style="padding:0 15px;">
    <div class="layui-col-md12">
      <div id="header">
        周计划看板
      </div>
    </div>
  </div>

  <div class="layui-fluid" style="padding-bottom: 0px;padding-top:0px;">
    <div class="layui-row layui-col-space10">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-header">
            <img src="../images/批量.png" height="26" alt="" />
            批产<span id="type">本周</span>周计划
          </div>
          <div class="layui-card-body" style="padding-top:0px;">
            <div style="margin-bottom:5px;">
              <div class="finished-lable status-lable">
                大阶段已完工
              </div>
              <div class="green-lable status-lable">
                已完成集件
              </div>
              <div class="yellow-lable status-lable">
                超期未集件
              </div>
              <div class="red-lable status-lable">
                期量内未集件
              </div>
              <div class="transparent-lable status-lable">
                不集件 | 未到期量期
              </div>
              <button type="button" class="layui-btn layui-btn-sm" id="prevWeek"
                style="font-size:16px;margin-left:20px;">
                上周计划 <i class="layui-icon" style="font-weight:bold;">&#xe615</i>
              </button>
              <button type="button" class="layui-btn layui-btn-sm" id="thisWeek" style="font-size:16px;">
                本周计划 <i class="layui-icon" style="font-weight:bold;">&#xe615</i>
              </button>
              <button type="button" class="layui-btn layui-btn-sm" id="nextWeek" style="font-size:16px;">
                下周计划 <i class="layui-icon" style="font-weight:bold;">&#xe615</i>
              </button>
            </div>
            <table class="layui-table" id="pichanPlan">
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <script type="text/javascript" src="../StaticFiles/layui/dist/layui.js"></script>
  <script type="text/javascript">
    $(function () {
      $(".layui-card:last-child").css({ "marginBottom": "0px" });
      function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
      };
      var $factoryid = getUrlParam('factoryid');

      layui.use(['layer', 'table'], function () {
        var table = layui.table;
        var layer = layui.layer;
        var tipsIndex = null;

        function showTip(data) {
          if (data === '') {
            tipsIndex = layer.tips('大阶段未维护备注信息', '#showTip', { tips: [1, '#FF5722'], time: 10000 });
          } else {
            tipsIndex = layer.tips(data, '#showTip', { tips: [1, '#FF5722'], time: 10000 });
          }
        };

        //弹出层通用方法
        function openDialog(config) {
          var index2 = layer.load(0, { shade: [0.5, '#000'], time: 1000 * 1000 });
          layer.open({
            title: config.title,
            type: 1,
            content: "<table class='layui-hide' id='test'></table>",
            area: ['100%', '100%'],
            skin: 'layui-layer-rim',
            success: function (layero) {
              table.render({
                elem: '#test',
                url: config.url,
                method: 'POST',
                cols: config.cols,
                where: config.QueryString,
                cellMinWidth: 80,
                page: false,
                text: {
                  none: '暂无相关数据'
                },
                done: function (res, curr, count) {
                  layer.close(index2);
                  var that = this.elem.next();
                  res.data.forEach(function (item, index) {
                    if (index % 2 !== 0) {
                      var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css({ "background": "#eee" });
                    }
                  });
                }
              });
            }
          });
        };

        //各发动机本周任务
        function GetZSWeekPlanInfo(week) {
          var index = null;
          $.ajax({
            type: "Post",
            url: "../handler/board/ZSWeekPlanLookBoard.ashx?type=GetPichan",
            dataType: "text",
            cache: false,
            beforeSend: function () {
              index = layer.load(0, { shade: [0.5, '#000'], time: 1000 * 1000 });
            },
            data: {
              week: week
            },
            success: function (result) {
              layer.close(index);
              var data = JSON.parse(result);
              var $pichanPlan = $("#pichanPlan");
              $pichanPlan.empty();
              var strTable = "<tr><th>发动机号</th><th>周一</th><th>周二</th><th>周三</th><th>周四</th><th>周五</th><th>周六</th><th>周日</th></tr>";
              $("#pichanPlan").append(strTable);
              // 生成表格内容
              for (var i = 0; i < data.length; i++) {
                var trTemp = $("<tr></tr>");

                //发动机号
                trTemp.append("<td>" + data[i].ATTRIBUTEVALUE + "</td>");

                //周一
                if (data[i].Mon !== "" && data[i].Mon.indexOf(';') !== -1) {
                  var workflowstep = data[i].Mon.split(';');
                  var td = $("<td></td>");
                  for (var j = 0; j < workflowstep.length; j++) {
                    if (workflowstep[j].split('&')[1] === "red") {
                      td.append("<div class='red' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "yellow") {
                      td.append("<div class='yellow' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "green") {
                      td.append("<div class='green' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "finished") {
                      td.append("<div class='finished' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else {
                      td.append("<div class='transparent' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    }
                    trTemp.append(td);
                  }
                } else if (data[i].Mon !== "" && data[i].Mon.indexOf(';') === -1) {
                  if (data[i].Mon.split('&')[1] === "red") {
                    trTemp.append("<td><div class='red' data='" + data[i].Mon.split('&')[2] + "'>" + data[i].Mon.split('&')[0] + "</div></td>");
                  } else if (data[i].Mon.split('&')[1] === "yellow") {
                    trTemp.append("<td><div class='yellow' data='" + data[i].Mon.split('&')[2] + "'>" + data[i].Mon.split('&')[0] + "</div></td>");
                  } else if (data[i].Mon.split('&')[1] === "green") {
                    trTemp.append("<td><div class='green' data='" + data[i].Mon.split('&')[2] + "'>" + data[i].Mon.split('&')[0] + "</div></td>");
                  } else if (data[i].Mon.split('&')[1] === "finished") {
                    trTemp.append("<td><div class='finished' data='" + data[i].Mon.split('&')[2] + "'>" + data[i].Mon.split('&')[0] + "</div></td>");
                  } else {
                    trTemp.append("<td><div class='transparent' data='" + data[i].Mon.split('&')[2] + "'>" + data[i].Mon.split('&')[0] + "</div></td>");
                  }
                } else {
                  trTemp.append("<td></td>");
                }

                //周二
                if (data[i].Tue !== "" && data[i].Tue.indexOf(';') !== -1) {
                  var workflowstep = data[i].Tue.split(';');
                  var td = $("<td></td>");
                  for (var j = 0; j < workflowstep.length; j++) {
                    if (workflowstep[j].split('&')[1] === "red") {
                      td.append("<div class='red' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "yellow") {
                      td.append("<div class='yellow' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "green") {
                      td.append("<div class='green' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "finished") {
                      td.append("<div class='finished' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else {
                      td.append("<div class='transparent' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    }
                    trTemp.append(td);
                  }
                } else if (data[i].Tue !== "" && data[i].Tue.indexOf(';') === -1) {
                  if (data[i].Tue.split('&')[1] === "red") {
                    trTemp.append("<td><div class='red' data='" + data[i].Tue.split('&')[2] + "'>" + data[i].Tue.split('&')[0] + "</div></td>");
                  } else if (data[i].Tue.split('&')[1] === "yellow") {
                    trTemp.append("<td><div class='yellow' data='" + data[i].Tue.split('&')[2] + "'>" + data[i].Tue.split('&')[0] + "</div></td>");
                  } else if (data[i].Tue.split('&')[1] === "green") {
                    trTemp.append("<td><div class='green' data='" + data[i].Tue.split('&')[2] + "'>" + data[i].Tue.split('&')[0] + "</div></td>");
                  } else if (data[i].Tue.split('&')[1] === "finished") {
                    trTemp.append("<td><div class='finished' data='" + data[i].Tue.split('&')[2] + "'>" + data[i].Tue.split('&')[0] + "</div></td>");
                  } else {
                    trTemp.append("<td><div class='transparent' data='" + data[i].Tue.split('&')[2] + "'>" + data[i].Tue.split('&')[0] + "</div></td>");
                  }
                } else {
                  trTemp.append("<td></td>");
                }

                //周三
                if (data[i].Wed !== "" && data[i].Wed.indexOf(';') !== -1) {
                  var workflowstep = data[i].Wed.split(';');
                  var td = $("<td></td>");
                  for (var j = 0; j < workflowstep.length; j++) {
                    if (workflowstep[j].split('&')[1] === "red") {
                      td.append("<div class='red' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "yellow") {
                      td.append("<div class='yellow' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "green") {
                      td.append("<div class='green' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "finished") {
                      td.append("<div class='finished' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else {
                      td.append("<div class='transparent' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    }
                    trTemp.append(td);
                  }
                } else if (data[i].Wed !== "" && data[i].Wed.indexOf(';') === -1) {
                  if (data[i].Wed.split('&')[1] === "red") {
                    trTemp.append("<td><div class='red' data='" + data[i].Wed.split('&')[2] + "'>" + data[i].Wed.split('&')[0] + "</div></td>");
                  } else if (data[i].Wed.split('&')[1] === "yellow") {
                    trTemp.append("<td><div class='yellow' data='" + data[i].Wed.split('&')[2] + "'>" + data[i].Wed.split('&')[0] + "</div></td>");
                  } else if (data[i].Wed.split('&')[1] === "green") {
                    trTemp.append("<td><div class='green' data='" + data[i].Wed.split('&')[2] + "'>" + data[i].Wed.split('&')[0] + "</div></td>");
                  } else if (data[i].Wed.split('&')[1] === "finished") {
                    trTemp.append("<td><div class='finished' data='" + data[i].Wed.split('&')[2] + "'>" + data[i].Wed.split('&')[0] + "</div></td>");
                  } else {
                    trTemp.append("<td><div class='transparent' data='" + data[i].Wed.split('&')[2] + "'>" + data[i].Wed.split('&')[0] + "</div></td>");
                  }
                } else {
                  trTemp.append("<td></td>");
                }

                //周四
                if (data[i].Thu !== "" && data[i].Thu.indexOf(';') !== -1) {
                  var workflowstep = data[i].Thu.split(';');
                  var td = $("<td></td>");
                  for (var j = 0; j < workflowstep.length; j++) {
                    if (workflowstep[j].split('&')[1] === "red") {
                      td.append("<div class='red' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "yellow") {
                      td.append("<div class='yellow' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "green") {
                      td.append("<div class='green' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "finished") {
                      td.append("<div class='finished' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else {
                      td.append("<div class='transparent' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    }
                    trTemp.append(td);
                  }
                } else if (data[i].Thu !== "" && data[i].Thu.indexOf(';') === -1) {
                  if (data[i].Thu.split('&')[1] === "red") {
                    trTemp.append("<td><div class='red' data='" + data[i].Thu.split('&')[2] + "'>" + data[i].Thu.split('&')[0] + "</div></td>");
                  } else if (data[i].Thu.split('&')[1] === "yellow") {
                    trTemp.append("<td><div class='yellow' data='" + data[i].Thu.split('&')[2] + "'>" + data[i].Thu.split('&')[0] + "</div></td>");
                  } else if (data[i].Thu.split('&')[1] === "green") {
                    trTemp.append("<td><div class='green' data='" + data[i].Thu.split('&')[2] + "'>" + data[i].Thu.split('&')[0] + "</div></td>");
                  } else if (data[i].Thu.split('&')[1] === "finished") {
                    trTemp.append("<td><div class='finished' data='" + data[i].Thu.split('&')[2] + "'>" + data[i].Thu.split('&')[0] + "</div></td>");
                  } else {
                    trTemp.append("<td><div class='transparent' data='" + data[i].Thu.split('&')[2] + "'>" + data[i].Thu.split('&')[0] + "</div></td>");
                  }
                } else {
                  trTemp.append("<td></td>");
                }

                //周五
                if (data[i].Fri !== "" && data[i].Fri.indexOf(';') !== -1) {
                  var workflowstep = data[i].Fri.split(';');
                  var td = $("<td></td>");
                  for (var j = 0; j < workflowstep.length; j++) {
                    if (workflowstep[j].split('&')[1] === "red") {
                      td.append("<div class='red' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "yellow") {
                      td.append("<div class='yellow' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "green") {
                      td.append("<div class='green' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "finished") {
                      td.append("<div class='finished' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else {
                      td.append("<div class='transparent' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    }
                    trTemp.append(td);
                  }
                } else if (data[i].Fri !== "" && data[i].Fri.indexOf(';') === -1) {
                  if (data[i].Fri.split('&')[1] === "red") {
                    trTemp.append("<td><div class='red' data='" + data[i].Fri.split('&')[2] + "'>" + data[i].Fri.split('&')[0] + "</div></td>");
                  } else if (data[i].Fri.split('&')[1] === "yellow") {
                    trTemp.append("<td><div class='yellow' data='" + data[i].Fri.split('&')[2] + "'>" + data[i].Fri.split('&')[0] + "</div></td>");
                  } else if (data[i].Fri.split('&')[1] === "green") {
                    trTemp.append("<td><div class='green' data='" + data[i].Fri.split('&')[2] + "'>" + data[i].Fri.split('&')[0] + "</div></td>");
                  } else if (data[i].Fri.split('&')[1] === "finished") {
                    trTemp.append("<td><div class='finished' data='" + data[i].Fri.split('&')[2] + "'>" + data[i].Fri.split('&')[0] + "</div></td>");
                  } else {
                    trTemp.append("<td><div class='transparent' data='" + data[i].Fri.split('&')[2] + "'>" + data[i].Fri.split('&')[0] + "</div></td>");
                  }
                } else {
                  trTemp.append("<td></td>");
                }

                //周六
                if (data[i].Sat !== "" && data[i].Sat.indexOf(';') !== -1) {
                  var workflowstep = data[i].Sat.split(';');
                  var td = $("<td></td>");
                  for (var j = 0; j < workflowstep.length; j++) {
                    if (workflowstep[j].split('&')[1] === "red") {
                      td.append("<div class='red' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "yellow") {
                      td.append("<div class='yellow' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "green") {
                      td.append("<div class='green' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "finished") {
                      td.append("<div class='finished' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else {
                      td.append("<div class='transparent' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    }
                    trTemp.append(td);
                  }
                } else if (data[i].Sat !== "" && data[i].Sat.indexOf(';') === -1) {
                  if (data[i].Sat.split('&')[1] === "red") {
                    trTemp.append("<td><div class='red' data='" + data[i].Sat.split('&')[2] + "'>" + data[i].Sat.split('&')[0] + "</div></td>");
                  } else if (data[i].Sat.split('&')[1] === "yellow") {
                    trTemp.append("<td><div class='yellow' data='" + data[i].Sat.split('&')[2] + "'>" + data[i].Sat.split('&')[0] + "</div></td>");
                  } else if (data[i].Sat.split('&')[1] === "green") {
                    trTemp.append("<td><div class='green' data='" + data[i].Sat.split('&')[2] + "'>" + data[i].Sat.split('&')[0] + "</div></td>");
                  } else if (data[i].Sat.split('&')[1] === "finished") {
                    trTemp.append("<td><div class='finished' data='" + data[i].Sat.split('&')[2] + "'>" + data[i].Sat.split('&')[0] + "</div></td>");
                  } else {
                    trTemp.append("<td><div class='transparent' data='" + data[i].Sat.split('&')[2] + "'>" + data[i].Sat.split('&')[0] + "</div></td>");
                  }
                } else {
                  trTemp.append("<td></td>");
                }

                //周日
                if (data[i].Sun !== "" && data[i].Sun.indexOf(';') !== -1) {
                  var workflowstep = data[i].Sun.split(';');
                  var td = $("<td></td>");
                  for (var j = 0; j < workflowstep.length; j++) {
                    if (workflowstep[j].split('&')[1] === "red") {
                      td.append("<div class='red' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "yellow") {
                      td.append("<div class='yellow' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "green") {
                      td.append("<div class='green' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else if (workflowstep[j].split('&')[1] === "finished") {
                      td.append("<div class='finished' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    } else {
                      td.append("<div class='transparent' data='" + workflowstep[j].split('&')[2] + "'>" + workflowstep[j].split('&')[0] + "</div>");
                    }
                    trTemp.append(td);
                  }
                } else if (data[i].Sun !== "" && data[i].Sun.indexOf(';') === -1) {
                  if (data[i].Sun.split('&')[1] === "red") {
                    trTemp.append("<td><div class='red' data='" + data[i].Sun.split('&')[2] + "'>" + data[i].Sun.split('&')[0] + "</div></td>");
                  } else if (data[i].Sun.split('&')[1] === "yellow") {
                    trTemp.append("<td><div class='yellow' data='" + data[i].Sun.split('&')[2] + "'>" + data[i].Sun.split('&')[0] + "</div></td>");
                  } else if (data[i].Sun.split('&')[1] === "green") {
                    trTemp.append("<td><div class='green' data='" + data[i].Sun.split('&')[2] + "'>" + data[i].Sun.split('&')[0] + "</div></td>");
                  } else if (data[i].Sun.split('&')[1] === "finished") {
                    trTemp.append("<td><div class='finished' data='" + data[i].Sun.split('&')[2] + "'>" + data[i].Sun.split('&')[0] + "</div></td>");
                  } else {
                    trTemp.append("<td><div class='transparent' data='" + data[i].Sun.split('&')[2] + "'>" + data[i].Sun.split('&')[0] + "</div></td>");
                  }
                } else {
                  trTemp.append("<td></td>");
                }
                $pichanPlan.append(trTemp);
              };

              //发动机各大阶段点击查看明细
              $("#pichanPlan td div").each(function () {
                var that = $(this);

                that.bind('mouseenter', function () {
                  that.attr('id', 'showTip');
                  showTip(that.attr('data'));
                });

                that.bind('mouseleave', function () {
                  layer.close(tipsIndex);
                  that.attr('id', '');
                });

                that.click(function () {
                  var config = {};
                  config.QueryString = {
                    workflowstepname: $(this).text(),
                    engineno: $(this).parent().parent().find("td").eq(0).text(),
                    week: week
                  };
                  config.url = "../handler/board/ZSWeekPlanLookBoard.ashx?type=GetDetails";
                  config.title = "发动机：" + $(this).parent().parent().find("td").eq(0).text() + " -- 大阶段：" + $(this).text()
                    + " -- 完工及发料信息明细" + "<i class='layui-icon layui-icon-log' style='font-size:20px;'></i>";
                  config.cols = [[
                    { type: 'numbers', title: '序号', width: 60 }
                    , { field: 'MFGORDERNAME', title: '订单号', align: 'center' }
                    , { field: 'ATTRIBUTEVALUE', title: '发动机号', align: 'center' }
                    , { field: 'WORKFLOWSTEPNAME', title: '阶段', align: 'center' }
                    , {
                      field: 'PLANNEDSTARTDATE', title: '计划开始日期', align: 'center',
                      templet: function (d) {
                        if (d.PLANNEDSTARTDATE === null) {
                          return "";
                        } else {
                          return d.PLANNEDSTARTDATE.split('T')[0];
                        }
                      }

                    }
                    , { field: 'QILIANGDAYS', title: '期量', align: 'center' }
                    , {
                      field: 'TODAY', title: '当前日期', align: 'center',
                      templet: function (d) {
                        if (d.TODAY === null) {
                          return "";
                        } else {
                          return d.TODAY.split('T')[0];
                        }
                      }

                    }
                    , {
                      field: 'USECOMPLETED', title: '完工状态', align: 'center',
                      templet: function (d) {
                        if (d.USECOMPLETED == '已完工') {
                          return '<span style="background-color: #00FF00;padding:5px;color:#000;border-radius:3px;">' + d.USECOMPLETED + '</span>';
                        } else {
                          return '<span style="background-color: red;padding:5px;color:#fff;border-radius:3px;">' + d.USECOMPLETED + '</span>';
                        }
                      }
                    }
                    , {
                      field: 'FINISHDATE', title: '完工日期', align: 'center',
                      templet: function (d) {
                        if (d.FINISHDATE === null) {
                          return "";
                        } else {
                          return d.FINISHDATE.split('T')[0];
                        }
                      }

                    }
                    , { field: 'PRODUCTNAME', title: '大零件', align: 'center' }
                    , {
                      field: 'STATUS', title: '发料状态', align: 'center',
                      templet: function (d) {
                        if (d.STATUS == '已发料') {
                          return '<span style="background-color: #5FB878;padding:5px;color:#fff;border-radius:3px;">' + d.STATUS + '</span>';
                        } else if (d.STATUS == '超期未发料') {
                          return '<span style="background-color: red;padding:5px;color:#fff;border-radius:3px;">' + d.STATUS + '</span>';
                        } else if (d.STATUS == '期量内未发料') {
                          return '<span style="background-color: yellow;padding:5px;color:#000;border-radius:3px;">' + d.STATUS + '</span>';
                        } else {
                          return '<span>' + d.STATUS + '</span>';
                        }
                      }
                    }

                  ]];
                  openDialog(config);
                });
              })
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
            }
          });
        };
        GetZSWeekPlanInfo('thisWeek');

        $('#prevWeek').click(function () {
          GetZSWeekPlanInfo('prevWeek');
          $('#type').text('上周');
        });

        $('#thisWeek').click(function () {
          GetZSWeekPlanInfo('thisWeek');
          $('#type').text('本周');
        });

        $('#nextWeek').click(function () {
          GetZSWeekPlanInfo('nextWeek');
          $('#type').text('下周');
        });

      });
    });
  </script>
</body>

</html>